package dev.huidocs.docs.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import java.util.Date;
import java.util.Objects;
import com.gitee.coadmin.base.BaseEntity;

/**
 * Resource history
 * @author jinjin
 * @since 2024-10-11
 */
@Getter
@Setter
@NoArgsConstructor
@TableName("doc_res_history")
public class DocResHistory extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @TableId(type= IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty(value = "doc_res.id")
    private Long resId;

    @ApiModelProperty(value = "修订类型(1=修改内容，5=修改元数据，10=可交互组件的状态变化)")
    private Integer revisionType;

    @ApiModelProperty(value = "此版本文件路径")
    private String filePath;

    @ApiModelProperty(value = "此版本文件名(不扩展名)")
    private String fileName;

    @ApiModelProperty(value = "此版本文件扩展名")
    private String fileExtension;

    @ApiModelProperty(value = "此版本描述(限制字数)")
    private String description;

    @ApiModelProperty(value = "创建人")
    private Long createUser;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DocResHistory obj = (DocResHistory) o;
        return Objects.equals(id, obj.id);
    }
    
    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    public void copyFrom(DocResHistory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
